function init() {
	let server = getServer();
	let credential = getCredential();
	setupSaving();
	dyalogInit();
	document.getElementById('ip').value = server.addr;
	document.getElementById('port').value = server.port;
	document.getElementById('secure').checked = server.secure;
	document.getElementById('username').value = credential.username || '';
	document.getElementById('password').value = credential.password || '';
	if (!parcel.ws) {
		setTimeout(function () {
			let timer = setTimeout(function () {
				startConnection();
			}, 2000);
			actionToast('正在连接服务器', '取消', function () {
				clearTimeout(timer);
			});
		}, 1000);
	}

	bindEnterKey(document.getElementById('password'), () => {
		start();
	});

	bindCtrlEnterKey(document.getElementById('typebox'), () => {
		sendMessage();
	});
}
